﻿/*----------------------------------------------------------------
//  <copyright file="IOrganizationClaimStore.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2023-09-21 10:02</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Identity
{
    #region "为特定于组织机构的声明存储提供抽象"
    /// <summary>
    /// 为特定于组织机构的声明存储提供抽象
    /// </summary>
    /// <typeparam name="TOrganization">组织机构实体类型</typeparam>
    public interface IOrganizationClaimStore<TOrganization> : IOrganizationStore<TOrganization>, IDisposable where TOrganization : class
    {
        #region "方法"
        #region "获取属于指定 <paramref name="TOrganization"/> 的 <see cref="Claim"/> 的列表"
        /// <summary>
        /// 获取属于指定 <paramref name="organization"/> 的<see cref="Claim"/> 的列表
        /// </summary>
        /// <param name="organization">要检索的组织机构</param>
        /// <returns>
        /// <see cref="IList{Claim}" /> 结果
        /// </returns>
        IList<Claim> GetClaims(TOrganization organization);
        #endregion
        #region "向组织机构添加新声明"
        /// <summary>
        /// 向组织机构添加新声明
        /// </summary>
        /// <param name="organization">要向其添加声明的组织机构</param>
        /// <param name="claim">将要添加的 <see cref="Claim" /></param>
        void AddClaim(TOrganization organization, Claim claim);
        #endregion
        #region "从组织机构中移除声明"
        /// <summary>
        /// 从组织机构中移除声明
        /// </summary>
        /// <param name="organization">从中移除声明的组织机构</param>
        /// <param name="claim">将要移除的 <see cref="Claim" /></param>
        void RemoveClaim(TOrganization organization, Claim claim);
        #endregion

        #region "异步获取属于指定 <paramref name="organization"/> 的 <see cref="Claim"/> 的列表"
        /// <summary>
        /// 异步获取属于指定 <paramref name="organizationEntity"/> 的 <see cref="Claim"/> 的列表
        /// </summary>
        /// <param name="organizationEntity">要检索的组织机构</param>
        /// <param name="cancellationToken"><see cref="CancellationToken" /> 用于传播应取消操作的通知</param>
        /// <returns>
        /// 包含 <see cref="IList{Claim}" /> 的 <see cref="Task" /> 结果
        /// </returns>
        Task<IList<Claim>> GetClaimsAsync(TOrganization organizationEntity, CancellationToken cancellationToken = new CancellationToken());
        #endregion
        #region "异步向组织机构添加新声明"
        /// <summary>
        /// 异步向组织机构添加新声明
        /// </summary>
        /// <param name="organizationEntity">要向其添加声明的组织机构</param>
        /// <param name="claim">将要添加的<see cref="Claim" /></param>
        /// <param name="cancellationToken"><see cref="CancellationToken" />用于传播应取消操作的通知</param>
        /// <returns>表示异步操作的任务对象</returns>
        Task AddClaimAsync(TOrganization organizationEntity, Claim claim, CancellationToken cancellationToken = new CancellationToken());
        #endregion
        #region "异步从组织机构中移除声明"
        /// <summary>
        /// 异步从组织机构中移除声明
        /// </summary>
        /// <param name="organizationEntity">从中移除声明的组织机构</param>
        /// <param name="claim">将要移除的 <see cref="Claim" /></param>
        /// <param name="cancellationToken"><see cref="CancellationToken" /> 用于传播应取消操作的通知</param>
        /// <returns>表示异步操作的任务对象</returns>
        Task RemoveClaimAsync(TOrganization organizationEntity, Claim claim, CancellationToken cancellationToken = new CancellationToken());
        #endregion

        #endregion

    }
    #endregion

}
